/*
package com.yx.changdao.web.controller;

import com.yx.changdao.common.entity.CommunityBuild;
import com.yx.changdao.common.entity.CommunityBuildDetail;
import com.yx.changdao.common.entity.CommunityResident;
import com.yx.changdao.common.vo.BuildBuildVo;
import com.yx.changdao.common.entity.CommunityRegion;
import com.yx.changdao.service.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yx.changdao.common.annotation.AutoLog;
import com.yx.changdao.common.annotation.ShiroDesc;
import com.yx.changdao.common.data.Result;
import com.yx.changdao.common.exception.AlertException;
import com.yx.changdao.common.utils.SysUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;


*/
/**
 * @Description: <br/>
 * 区域信息表
 * <p>
 * <br/>
 * @Auther: walter
 * @create 2020/04/02 16:42
 *//*

@Validated
@RestController
@RequestMapping("community/region")
public class CommunityRegionController {


    */
/**
     * 网格信息库表服务
     *//*

    @Autowired
    private GridInfoService gridInfoService;
    */
/**
     * 区域信息表服务
     *//*

    @Autowired
    private CommunityRegionService communityRegionService;
    */
/**
     * 社区建筑物表服务
     *//*

    @Autowired
    private CommunityBuildService communityBuildService;
    */
/**
     * 户的服务
     *//*

    @Autowired
    private CommunityBuildDetailService communityBuildDetailService;
    @Autowired
    private CommunityResidentService communityResidentService;


    */
/**
     * 列表
     *
     * @return Result
     *//*

    @AutoLog
    @GetMapping("/list")
    public Result list() throws AlertException {
        return Result.ok().data(communityRegionService.list(SysUtils.autoCnd(CommunityRegion.class)
                .orderByDesc(CommunityRegion.CREATE_TIME)));
    }


    */
/**
     * 添加区域信息表
     *
     * @param
     * @return Result
     *//*

    @AutoLog
    @PostMapping
    public Result add(@RequestBody @Valid CommunityRegion communityRegion) throws AlertException {
        CommunityRegion one = communityRegionService.getOne(new QueryWrapper<CommunityRegion>().lambda().eq(CommunityRegion::getRegionName, communityRegion.getRegionName()));
        if (one != null) {
            return Result.error("该小区已存在");
        }
        boolean b = communityRegionService.save(communityRegion);

        if (!b) {
            throw new AlertException("区域信息添加失败");
        }

        return Result.ok("区域信息添加成功");
    }


    */
/**
     * 获得指定id 区域信息表。
     *
     * @param
     * @return Result
     *//*

    @AutoLog
    @GetMapping("/{id}")
    public Result get(@PathVariable("id") String id) throws AlertException {
        CommunityRegion communityRegion = communityRegionService.getById(id);

        if (communityRegion == null) {
            throw new AlertException("未找到相关区域信息");
        }

        return Result.ok().data(communityRegion);
    }


    */
/**
     * 更新区域信息表
     *
     * @param
     * @return Result
     *//*

    @AutoLog
    @PutMapping
    public Result update(@RequestBody @Valid CommunityRegion communityRegion) throws AlertException {

        boolean b = communityRegionService.updateById(communityRegion);
        if (!b) {
            throw new AlertException("区域信息更新失败");
        }

        return Result.ok("区域信息更新成功");
    }


    */
/**
     * 删除区域信息表
     *
     * @param
     * @return Result
     *//*

    @AutoLog
    @DeleteMapping("/{id}")
    @Transactional(rollbackFor = {Exception.class})
    public Result delete(@PathVariable("id") String id) throws AlertException {
        boolean b1 = communityRegionService.removeBuild(Integer.parseInt(id));
        if (!b1) {
            throw new AlertException("区域信息删除失败");
        }
        //删除区
        boolean b = communityRegionService.removeById(id);
        if (!b) {
            throw new AlertException("区域信息删除失败");
        }

        return Result.ok("删除区域信息成功");
    }


    */
/**
     * 根据网格id查区域
     * @return
     *//*

    @AutoLog
    @GetMapping("/getByGridinfoId")
    public Result  getByGridinfoId(@RequestParam("gridInfoId") Integer gridInfoId){
        List<CommunityRegion> byGridinfoId = communityRegionService.getByGridinfoId(gridInfoId);
        List<BuildBuildVo> buildBuildVoList=new ArrayList<>();
        for (CommunityRegion communityRegion : byGridinfoId) {
            BuildBuildVo buildBuildVo=new BuildBuildVo();
            buildBuildVo.setId(communityRegion.getId());
            buildBuildVo.setName(communityRegion.getRegionName());
            buildBuildVo.setParent_id(gridInfoId);
            buildBuildVoList.add(buildBuildVo);
        }
        return Result.ok("查询成功").data(buildBuildVoList);
    }
}
*/
